﻿<UserControl x:Class="Wpf2.Views.FormQuanlykho"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Height="Auto" Width="Auto">
    <StackPanel Name="tkpMain1"  Height="auto"  Width="Auto">
        <StackPanel Margin="0,5,0,0" Orientation="Horizontal" Height="50" Width="Auto">
            <StackPanel.Background>
                <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}"/>
            </StackPanel.Background>
            <ListView MaxWidth="1200" Height="80" HorizontalAlignment="Left" Name="lvCatalog" ItemsSource="{Binding}" Width="Auto" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectedIndex="0" SelectionChanged="LvCatalogSelectionChanged">
                <ListView.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionColorKey}}"/>
                </ListView.Background>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemTemplate>
                    <DataTemplate >
                        <Border BorderBrush="Blue" BorderThickness="1" HorizontalAlignment="Left" Margin="0,-30,10,0" VerticalAlignment="Top" Background="#FF16499A"  >
                            <StackPanel Orientation="Horizontal" Height="30" Width="120" HorizontalAlignment="Center" VerticalAlignment="Top">
                                <Image Source="/Wpf2;component/Images/catalog.png" Width="30" Height="30"/>
                                <TextBlock Text="{Binding CatalogName}" VerticalAlignment="Center" Margin="2,0,0,0" Foreground="#FFFCFCFC"/>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackPanel>
        <Border Height="48" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Margin="0,5,0,0">
            <StackPanel Orientation="Horizontal">

                <Border Height="48" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Margin="0,0,0,0">
                    <StackPanel Visibility="Collapsed" Orientation="Horizontal" Name="stpPassword"  >
                        <StackPanel Margin="5,0,0,0" HorizontalAlignment="Right"  Width="120" Height="30" Orientation="Horizontal">
                            <PasswordBox Padding="5" Background="#FF16499A"  Foreground="#FFF6F6F6" Name="txtPassword"  Height="30" Width="90" PreviewKeyUp="TxtPasswordPreviewKeyUp"></PasswordBox>
                            <Button x:Name="btnCheckPass" Width="30"  HorizontalAlignment="Left"   Background="#FF0050EF" Click="BtnCheckPassClick">
                                <StackPanel Orientation="Horizontal" >
                                    <Image Source="/Wpf2;component/Images/lock.png" Width="20" Height="20"/>
                                </StackPanel>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                </Border>

                <Border Height="48" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" >
                    <StackPanel Visibility="Collapsed" Orientation="Horizontal" Name="stpPasswordCheck" >
                        <StackPanel Margin="5,0,0,0" HorizontalAlignment="Right"  Width="120" Height="30" Orientation="Horizontal">
                            <PasswordBox Padding="5" Name="txtPasswordCheck" Background="#FF16499A"  Foreground="#FFF6F6F6"  Height="30" Width="90" PreviewKeyUp="TxtPasswordCheckPreviewKeyUp"></PasswordBox>
                            <Button x:Name="btnCheckPassHideShow" Width="30"  HorizontalAlignment="Left"   Background="#FF0050EF" Click="BtnCheckPassHideShowClick">
                                <StackPanel Orientation="Horizontal" >
                                    <Image Source="/Wpf2;component/Images/lock.png" Width="20" Height="20"/>
                                </StackPanel>
                            </Button>
                        </StackPanel>

                    </StackPanel>
                </Border>

                <StackPanel Margin="10,0,10,0" HorizontalAlignment="Right"  Width="100" Height="30" Orientation="Horizontal">
                    <Button x:Name="btnShowHide" Click="BtnShowHideClick"  Width="70" Background="#16499A">
                        <TextBlock Foreground="#FFFCFCFC">Ẩn/Hiện cột</TextBlock>
                    </Button>
                    <StackPanel Width="30" Height="30" Background="#FF0050EF">
                        <Image Source="/Wpf2;component/Images/check.png" />
                    </StackPanel>
                </StackPanel>
                <StackPanel Margin="0,0,10,0" HorizontalAlignment="Right"  Width="100" Height="30" Orientation="Horizontal">
                    <Button x:Name="btnSum" Click="BtnSumClick"  Width="70" Background="#16499A">
                        <TextBlock Foreground="#FFFCFCFC">Tổng</TextBlock>
                    </Button>
                    <StackPanel Width="30" Height="30" Background="#FF0050EF">
                        <Image Source="/Wpf2;component/Images/sum.png" />
                    </StackPanel>
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <Label Content="Mã SP:" Height="28" Background="#FF0050EF" Foreground="White"/>
                    <Grid Height="28">
                        <TextBox Name="txtIDPro" Text=""  FontSize="16" HorizontalAlignment="Left" Background="#FF0050EF" Height="28" Width="100" Margin="0,0,0,0" TextChanged="TxtIDProTextChanged" Foreground="#FFF6F6F6" PreviewKeyDown="TxtIDProPreviewKeyDown" LostFocus="txtIDPro_LostFocus"/>
                        <ComboBox Name="cmbSearchByID" SelectionChanged="ComboBoxSelectionChanged" Visibility="Hidden"  IsTabStop="False" IsSynchronizedWithCurrentItem="True" ></ComboBox>
                    </Grid>
                    <Button x:Name="btnSearchbyid" Width="40"  HorizontalAlignment="Left" Margin="0,10" Click="BtnSearchbyidClick" Background="#FF16499A">
                        <StackPanel Orientation="Horizontal" >
                            <Image Source="/Wpf2;component/Images/searchicon.png" Width="20" Height="20"/>
                        </StackPanel>
                    </Button>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
                    <Label Content="Tên SP:" Height="28" Background="#FF0050EF" Foreground="White" />
                    <Grid Height="28">
                        <TextBox Name="txtSearchbyName" Text="" FontSize="16" HorizontalAlignment="Left" Background="#FF0050EF" Height="28" Width="100" Margin="0,0,0,0" TextChanged="TxtSearchbyNameTextChanged" Foreground="#FFFCFCFC" LostFocus="txtSearchbyName_LostFocus"/>
                        <ComboBox Name="cmbSearchByName"  Visibility="Hidden"  IsTabStop="False" IsSynchronizedWithCurrentItem="True" SelectionChanged="CmbSearchByNameSelectionChanged" ></ComboBox>
                    </Grid>
                    <Button  x:Name="btnSearchbyName" Width="40" HorizontalAlignment="Left" Margin="0,10" Click="BtnSearchbyNameClick" Background="#FF16499A">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Wpf2;component/Images/searchicon.png" Width="20" Height="20"/>
                        </StackPanel>
                    </Button>
                </StackPanel>

                <StackPanel Margin="20,0,20,0" HorizontalAlignment="Right"  Width="90" Height="30" Orientation="Horizontal">
                    <Button x:Name="btnPrint" Click="BtnPrintClick"  Width="60" Background="#16499A">
                        <TextBlock Foreground="#FFFCFCFC"> In</TextBlock>
                    </Button>
                    <StackPanel Width="30" Height="30" Background="#FF0050EF">
                        <Image Source="/Wpf2;component/Images/print.png" />
                    </StackPanel>
                </StackPanel>
                <StackPanel Height="30" Width="120" Orientation="Horizontal" Background="#FF16499A" Margin="0,9,395,9">
                    <Label Background="#FF0050EF" Foreground="White">Đá hoa cương</Label>
                </StackPanel>

            </StackPanel>
        </Border>
        <StackPanel Margin="0,5,0,0" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Name="stpHideShowColumn" Orientation="Horizontal" Visibility="Collapsed">
            <CheckBox Width="120"  Content="Mã SP" Checked="CheckBoxChecked2" Unchecked="CheckBoxUnchecked2"></CheckBox>
            <CheckBox Width="120"  Content="Tên SP" Checked="CheckBoxChecked3" Unchecked="CheckBoxUnchecked3"></CheckBox>
            <CheckBox Width="120"  Content="Mô tả" Checked="CheckBoxChecked4" Unchecked="CheckBoxUnchecked4"></CheckBox>
            <CheckBox Width="120"  Content="Số lượng" Checked="CheckBoxChecked5" Unchecked="CheckBoxUnchecked5"></CheckBox>
            <CheckBox Width="120"  Content="Giá lẻ" Checked="CheckBoxChecked6" Unchecked="CheckBoxUnchecked6"></CheckBox>
            <CheckBox Width="120"  Content="Giá sỉ" Checked="CheckBoxChecked7" Unchecked="CheckBoxUnchecked7"></CheckBox>
            <CheckBox Width="120"  Content="Đơn vị" Checked="CheckBoxChecked8" Unchecked="CheckBoxUnchecked8"></CheckBox>
            <CheckBox Width="120"  Content="Danh mục" Checked="CheckBoxChecked9" Unchecked="CheckBoxUnchecked9"></CheckBox>
        </StackPanel>
        <DataGrid Height="500" x:Name="dtgProduct" ItemsSource="{Binding}"  CanUserAddRows="True" AutoGenerateColumns="False" Width="Auto"  AlternatingRowBackground="PaleTurquoise" LoadingRow="DtgProductLoadingRow" Margin="0,5,0,0" IsReadOnly="True">
            <DataGrid.RowHeaderTemplate >
                <DataTemplate>
                    <TextBlock  Width="20" Text="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}"/>
                </DataTemplate>
            </DataGrid.RowHeaderTemplate>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Mã SP Auto" Width="30"  Binding="{Binding ProductIdAuto, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True" Visibility="Hidden"/>
                <DataGridTextColumn Header="Mã SP" Width="80"  Binding="{Binding ProductId, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Tên sản phẩm" Width="200" Binding="{Binding ProductName, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Mô tả" Width="150" Binding="{Binding ProductDescription, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="SL" Width="40" Binding="{Binding InventoryCount,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Dài" Visibility="Hidden" Width="50" Binding="{Binding ProductM2,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Rộng" Visibility="Hidden" Width="50" Binding="{Binding ProductM2,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="M2" Visibility="Hidden" Width="50" Binding="{Binding ProductM2,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Giá lẻ"  Width="150" Binding="{Binding SellPrice,UpdateSourceTrigger=PropertyChanged,StringFormat={}\{0:###\,##0\} VNĐ}"/>
                <DataGridTextColumn Header="Giá sỉ" Width="150" Binding="{Binding CostPrice,UpdateSourceTrigger=PropertyChanged,StringFormat={}\{0:###\,##0\} VNĐ}"/>
                <DataGridComboBoxColumn   Header="Đơn vị"  Width="50" x:Name="dtgcmbUnit" DisplayMemberPath="UnitName" SelectedValuePath="UnitID" SelectedValueBinding="{Binding UnitId,UpdateSourceTrigger=PropertyChanged}">
                </DataGridComboBoxColumn>
                <DataGridComboBoxColumn   Header="Danh mục"  Width="150" x:Name="dtgcmbCatalog" DisplayMemberPath="CatalogName" SelectedValuePath="IDCatalog" SelectedValueBinding="{Binding CatalogId,UpdateSourceTrigger=PropertyChanged}">
                </DataGridComboBoxColumn>
            </DataGrid.Columns>
        </DataGrid>
    </StackPanel>
</UserControl>
<!--done-->